/*
 * @Author: your name
 * @Date: 2020-01-04 23:13:52
 * @LastEditTime : 2020-01-06 02:02:50
 * @LastEditors  : Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /nest-app/src/photo/photo.controller.ts
 */
import {
  Controller,
  Get,
  Query,
  Request,
  Post,
  Body,
  Param,
} from '@nestjs/common';
import { PhotoService } from './photo.service';
import {
  ApiTags,
  ApiParam,
  ApiOperation,
  ApiProperty,
  ApiBody,
  ApiResponse,
} from '@nestjs/swagger';
import PhotoEntity from './photo.entity';

class CreatePhotoDTO {
  @ApiProperty({ required: true, description: '姓名' })
  name: string;

  @ApiProperty({ required: false, description: '年龄' })
  age: string;
}

@Controller('photo')
@ApiTags('photo')
export class PhotoController {
  constructor(private readonly appService: PhotoService) {}

  @Post('addPhoto')
  @ApiOperation({ summary: '创建相册' })
  @ApiResponse({ type: PhotoEntity })
  createPhoto(@Param() param: CreatePhotoDTO): Promise<PhotoEntity> {
    return this.appService.createPhoto();
  }

  @Get('info')
  getInfo(@Request() req): string {
    return 'req.query';
  }
}
